import 'package:eh_mobile/common/middlewares/index.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import '../../pages/index.dart';
import '../../pages/setup/setup/set_up_manage_controller.dart';
import '../../pages/setup/setup/set_up_manage_page.dart';
import '../middlewares/router_welcome.dart';
import 'index.dart';

// 路由配置页面
class RouterPages {
  // ignore: constant_identifier_names
  static const INITIAL = RouteNames.INITIAL;
  static final RouteObserver<Route> observer = RouteObservers();
  static List<String> history = [];

  static final List<GetPage> routes = [
    // 免登陆
    GetPage(
      name: RouterPages.INITIAL,
      page: () => const WelcomePage(),
      binding: BindingsBuilder(() => [Get.lazyPut(() => WelcomeController())]),
      middlewares: [
        RouteWelcomeMiddleware(priority: 0),
      ],
    ),

    GetPage(
        name: RouteNames.controlLightControl,
        page: () => const LightControlPage(),
        binding: BindingsBuilder(
            () => [Get.lazyPut(() => LightControlController())])),
    GetPage(
        name: RouteNames.mainHomepage,
        page: () => const HomepagePage(),
        binding:
            BindingsBuilder(() => [Get.lazyPut(() => HomepageController())]),
        middlewares: [RouteAuthMiddleware(priority: 1)]),
    GetPage(
        name: RouteNames.mainSmartHomeInfo,
        page: () =>  SmartHomeInfoPage(),
        binding:
            BindingsBuilder(() => [Get.put(() => SmartHomeInfoController())])),
    GetPage(
        name: RouteNames.message,
        page: () => MessagePage(),
        binding:
            BindingsBuilder(() => [Get.lazyPut(() => MessageController())])),
    GetPage(
        name: RouteNames.mine,
        page: () => const MinePage(),
        binding: BindingsBuilder(() => [Get.lazyPut(() => MineController())])),
    GetPage(
        name: RouteNames.setupSetFamily,
        page: () => const SetFamilyPage(),
        binding:
            BindingsBuilder(() => [Get.lazyPut(() => SetFamilyController())])),
    GetPage(
        name: RouteNames.setupSetup,
        page: () =>  SetupManagePage(),
        binding: BindingsBuilder(() => [Get.lazyPut(() => SetupManageController())])),
    GetPage(
        name: RouteNames.LOGIN,
        page: () => const LoginPage(),
        binding: BindingsBuilder(() => [Get.lazyPut(() => LoginController())])),
    GetPage(
        name: RouteNames.mainQrcodeScanner,
        page: () => const QrcodeScannerPage(),
        binding: BindingsBuilder(
            () => [Get.lazyPut(() => QrcodeScannerController())])),

    // 设备信息
    GetPage(
        name: RouteNames.controlDeviceInfo,
        page: () => const DeviceInfoPage(),
        binding:
            BindingsBuilder(() => [Get.lazyPut(() => DeviceInfoController())])),
    GetPage(
        name: RouteNames.controlDeviceArea,
        page: () => const DeviceAreaPage(),
        binding:
            BindingsBuilder(() => [Get.lazyPut(() => DeviceAreaController())])),

    GetPage(
        name: RouteNames.controlDeviceName,
        page: () => const DeviceNamePage(),
        binding:
            BindingsBuilder(() => [Get.lazyPut(() => DeviceNameController())])),
  ];
}
